﻿using GCC.Container.Abstracts;

namespace Z.AllInOneDemo
{
    public class GCCEntrance : AbsEntrance
    {
        public override bool IsRelease()
        {
#if DEBUG
            return false;
#else
            return true;
#endif
        }

        public override string Name()
        {
            return "Config Center";
        }

        public override Version NeedsApiContainerVersion()
        {
            GCCLoggerProvider?.CreateLogger<GCCEntrance>().Critical("Blend's entrance's NeedsApiContainerVersion method");
            return new Version("0.0.0.1");
        }

        public override void OnGetDBInstance()
        {
        }

        public override void OnSystemStarted(AbsGCCContext context)
        {

        }

        public override void SystemTryShutDown()
        {
            var log = GCCLoggerProvider!.CreateLogger<GCCEntrance>();
            Task.Delay(1000).Wait();
            log.Information("诶,我不关~");
            Task.Delay(1000).Wait();
            log.Information("诶,我就是不关~");
            Task.Delay(1000).Wait();
            log.Information("诶,我就是玩~");
            Task.Delay(1000).Wait();
            log.Information("好了,等我10秒,我还有事情...~");
            for (int i = 10 - 1; i >= 0; i--)
            {
                log.Information($"{i}");
                Task.Delay(1000).Wait();
            }

            log.Information("哈哈哈哈骗你的");
            Task.Delay(1000).Wait();
            log.Information("好了,不玩了,10秒后拜拜~");
            Task.Delay(1000 * 10).Wait();
        }
    }
}